package com.spsyry.pay.conteoller.mq;

import com.spsyry.common.core.domain.R;
import com.spsyry.pay.constatant.RabbitmqConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@RestController
//@RequestMapping("/mp")
@Slf4j
public class RabbitmqSendController {
    //@Autowired
    public RabbitTemplate rabbitTemplate;

    //@PostMapping(value = "/send")
    public R send()throws Exception{
        log.info("send...........");
        this.rabbitTemplate.convertAndSend(RabbitmqConstant.MQ_EXCHANGE_NAME,RabbitmqConstant.MQ_ROUTING_KEY,"2302a--测试消息");

        return R.ok();
    };
}
